#include<sys/mman.h>
#include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<errno.h>
#include<unistd.h>
#include<string.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
    int fd;
    fd=open(argv[1],O_RDWR|O_CREAT,0655);
    struct stat file_stat;
    stat(argv[1],&file_stat);
    int length=file_stat.st_size;
    void *addr= mmap(NULL,length,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_SHARED,fd,0);
    if(addr==NULL)
    {
        perror("mmap error");
        exit(1);
    }
    char buff[1024]={0};
    strncpy(buff,addr,1023);
    printf("%s",buff);
    munmap(addr,length);
    return 0;
}